#!/bin/sh

set -x
export PATH="/bin:/sbin:/usr/sbin:/usr/bin"


LOG='/tmp/autoddvpn.log'
LOCK='/tmp/autoddvpn.lock'
PID=$$
INFO="[INFO#${PID}]"
DEBUG="[DEBUG#${PID}]"
ERROR="[ERROR#${PID}]"

echo "$INFO $(date "+%d/%b/%Y:%H:%M:%S") vpndown.sh started" >> $LOG
for i in 1 2 3 4 5 6
do
   if [ -f $LOCK ]; then
      echo "$INFO $(date "+%d/%b/%Y:%H:%M:%S") got $LOCK , sleep 10 secs. #$i/6" >> $LOG
      sleep 10
   else
      break
   fi
done

if [ -f $LOCK ]; then
	echo "$ERROR $(date "+%d/%b/%Y:%H:%M:%S") still got $LOCK , I'm aborted. Fix me." >> $LOG
	exit 0
#else
#	echo "$INFO $(date "+%d/%b/%Y:%H:%M:%S") $LOCK was released, let's continue." >> $LOG
fi
	
# create the lock
echo "$INFO $(date "+%d/%b/%Y:%H:%M:%S") vpnup" >> $LOCK





OLDGW=$(nvram get wan_gateway)

case $1 in 
		"pptp")
			case "$(nvram get router_name)" in
				"tomato")
					#VPNSRV=$(nvram get pptpd_client_srvip)
					#VPNSRVSUB=$(nvram get pptpd_client_srvsub)
					#PPTPDEV=$(nvram get pptp_client_iface)
					VPNGW=$(nvram get pptp_client_gateway)
					;;
				"DD-WRT")                                                                 
					PPTPSRV=$(nvram get pptpd_client_srvip)
					VPNGW=$(nvram get pptp_gw)
					;;
			esac
			;;
		"openvpn")
			OPENVPNSRV=$(nvram get openvpncl_remoteip)
			OPENVPNDEV='tun0'
			VPNGW=$(ifconfig $OPENVPNDEV | grep -Eo "P-t-P:([0-9.]+)" | cut -d: -f2)
			;;
		*)
			echo "$INFO $(date "+%d/%b/%Y:%H:%M:%S") unknown vpndown.sh parameter, quit." >> $LOCK
			exit 1
			;;
esac
			


echo "[INFO] removing the static routes"

##### begin batch route #####
route del -net 1.51.0.0/16
route del -net 1.184.0.0/15
route del -net 8.6.19.68/32
route del -net 8.18.37.105/32
route del -net 8.18.55.177/32
route del -net 12.18.186.192/27
route del -net 12.26.55.108/32
route del -net 12.26.55.139/32
route del -net 12.71.45.96/27
route del -net 12.130.28.208/28
route del -net 12.154.67.128/25
route del -net 12.161.242.20/32
route del -net 12.161.242.72/32
route del -net 12.161.242.79/32
route del -net 12.161.242.84/32
route del -net 12.163.148.101/32
route del -net 12.166.173.0/26
route del -net 21.143.112.60/32
route del -net 27.148.0.0/14
route del -net 38.100.103.0/24
route del -net 38.100.138.149/32
route del -net 49.52.0.0/14
route del -net 49.120.0.0/14
route del -net 49.140.0.0/15
route del -net 49.208.0.0/15
route del -net 58.16.0.0/13
route del -net 58.24.0.0/15
route del -net 58.30.12.136/32
route del -net 58.32.232.0/22
route del -net 58.53.208.0/20
route del -net 58.59.1.15/32
route del -net 58.59.1.16/31
route del -net 58.59.128.0/17
route del -net 58.60.0.0/14
route del -net 58.66.0.0/15
route del -net 58.68.128.0/17
route del -net 58.83.128.0/17
route del -net 58.100.0.0/15
route del -net 58.116.0.0/14
route del -net 58.128.0.0/13
route del -net 58.154.0.0/15
route del -net 58.192.0.0/12
route del -net 58.208.0.0/20
route del -net 58.211.7.0/25
route del -net 58.211.15.0/24
route del -net 58.211.72.0/24
route del -net 58.211.80.0/24
route del -net 58.211.137.0/26
route del -net 58.211.141.0/24
route del -net 58.212.0.0/15
route del -net 58.214.0.0/16
route del -net 58.215.106.0/24
route del -net 58.217.128.0/17
route del -net 58.218.0.0/17
route del -net 58.240.0.0/15
route del -net 58.246.163.0/24
route del -net 58.248.0.0/13
route del -net 59.32.0.0/12
route del -net 59.48.0.0/15
route del -net 59.50.0.0/16
route del -net 59.54.0.0/16
route del -net 59.61.21.0/24
route del -net 59.61.128.0/19
route del -net 59.63.128.0/21
route del -net 59.64.0.0/12
route del -net 59.107.0.0/16
route del -net 59.108.0.0/15
route del -net 59.151.0.0/17
route del -net 59.175.128.0/20
route del -net 59.175.228.0/22
route del -net 60.0.0.0/11
route del -net 60.63.0.0/16
route del -net 60.166.0.0/16
route del -net 60.168.0.0/16
route del -net 60.190.28.0/24
route del -net 60.190.31.0/24
route del -net 60.190.38.0/23
route del -net 60.190.232.0/24
route del -net 60.190.241.0/24
route del -net 60.191.2.224/28
route del -net 60.194.0.0/15
route del -net 60.206.0.0/15
route del -net 60.208.0.0/13
route del -net 60.217.238.230/32
route del -net 60.217.239.110/32
route del -net 60.217.240.0/20
route del -net 60.247.0.0/17
route del -net 60.254.132.45/32
route del -net 61.4.82.0/23
route del -net 61.4.185.30/32
route del -net 61.4.188.0/24
route del -net 61.28.0.0/20
route del -net 61.29.128.0/17
route del -net 61.48.0.0/13
route del -net 61.56.222.160/28
route del -net 61.87.192.0/18
route del -net 61.128.0.0/10
route del -net 61.200.81.134/32
route del -net 61.200.81.144/31
route del -net 61.232.0.0/14
route del -net 61.236.0.0/15
route del -net 61.240.0.0/14
route del -net 62.32.98.6/32
route del -net 62.50.45.35/32
route del -net 62.50.45.40/31
route del -net 62.159.60.207/32
route del -net 62.159.60.208/31
route del -net 62.159.60.213/32
route del -net 62.159.60.214/32
route del -net 62.173.115.116/32
route del -net 63.73.227.0/24
route del -net 63.77.221.10/32
route del -net 63.84.162.0/24
route del -net 63.86.118.0/23
route del -net 63.86.141.0/24
route del -net 63.89.64.0/24
route del -net 63.123.194.0/24
route del -net 63.123.251.0/24
route del -net 63.125.146.0/24
route del -net 63.164.11.0/24
route del -net 63.208.197.0/24
route del -net 64.14.57.184/31
route del -net 64.14.57.186/32
route del -net 64.27.64.232/32
route del -net 64.27.100.115/32
route del -net 64.66.190.222/32
route del -net 64.94.28.5/32
route del -net 64.106.196.11/32
route del -net 64.106.196.17/32
route del -net 64.124.183.0/24
route del -net 64.124.231.0/24
route del -net 64.124.236.0/24
route del -net 64.151.65.167/32
route del -net 64.151.65.174/32
route del -net 64.242.1.105/32
route del -net 65.79.117.208/32
route del -net 65.168.92.218/32
route del -net 65.209.24.100/32
route del -net 65.209.24.102/32
route del -net 65.215.128.0/24
route del -net 65.216.151.6/32
route del -net 65.216.151.13/32
route del -net 65.244.170.7/32
route del -net 65.246.184.0/23
route del -net 65.249.64.96/27
route del -net 66.37.210.86/32
route del -net 66.45.81.158/32
route del -net 66.45.81.190/32
route del -net 66.70.68.187/32
route del -net 66.98.205.0/24
route del -net 66.114.58.27/32
route del -net 66.117.176.0/23
route del -net 66.129.106.149/32
route del -net 66.135.47.166/32
route del -net 66.135.51.239/32
route del -net 66.150.96.119/32
route del -net 67.72.105.0/24
route del -net 67.96.124.213/32
route del -net 69.32.132.0/24
route del -net 69.32.182.0/23
route del -net 69.32.226.0/24
route del -net 69.63.130.230/32
route del -net 69.63.132.223/32
route del -net 69.63.132.224/32
route del -net 69.63.136.133/32
route del -net 69.63.136.189/32
route del -net 69.174.241.123/32
route del -net 70.224.107.73/32
route del -net 72.3.141.36/32
route del -net 72.3.142.35/32
route del -net 72.3.188.104/32
route del -net 72.15.243.52/32
route del -net 72.15.246.200/32
route del -net 72.15.246.212/31
route del -net 72.15.246.216/31
route del -net 72.15.246.224/32
route del -net 72.15.246.226/32
route del -net 72.15.246.235/32
route del -net 72.15.246.243/32
route del -net 72.32.26.50/32
route del -net 72.32.203.14/32
route del -net 72.164.152.0/24
route del -net 72.233.2.58/32
route del -net 72.237.166.111/32
route del -net 74.200.243.253/32
route del -net 76.12.47.123/32
route del -net 76.74.252.80/32
route del -net 79.136.80.0/24
route del -net 82.109.207.14/32
route del -net 82.150.20.0/22
route del -net 82.165.43.115/32
route del -net 82.165.251.151/32
route del -net 82.197.80.72/29
route del -net 82.197.80.80/31
route del -net 82.197.80.82/32
route del -net 83.70.140.0/22
route del -net 83.138.144.214/32
route del -net 83.138.147.58/32
route del -net 83.138.175.80/31
route del -net 83.138.175.82/32
route del -net 83.231.175.18/31
route del -net 83.231.175.24/32
route del -net 83.231.175.37/32
route del -net 84.18.160.0/19
route del -net 87.102.111.227/32
route del -net 87.102.111.232/32
route del -net 87.102.111.236/32
route del -net 87.102.111.250/32
route del -net 91.208.107.0/24
route del -net 93.91.19.13/32
route del -net 93.93.131.33/32
route del -net 94.236.18.170/32
route del -net 98.129.198.65/32
route del -net 101.4.0.0/14
route del -net 101.76.0.0/15
route del -net 110.56.0.0/13
route del -net 110.64.0.0/15
route del -net 110.75.0.0/16
route del -net 110.76.0.0/19
route del -net 110.76.32.0/20
route del -net 110.96.0.0/11
route del -net 110.173.32.0/20
route del -net 110.173.192.0/19
route del -net 110.176.0.0/13
route del -net 110.189.128.0/18
route del -net 110.192.0.0/11
route del -net 111.67.192.0/20
route del -net 111.114.0.0/15
route del -net 111.116.0.0/15
route del -net 111.186.0.0/15
route del -net 112.64.0.0/15
route del -net 112.66.64.0/19
route del -net 112.66.96.0/21
route del -net 112.90.86.0/24
route del -net 112.90.136.0/21
route del -net 112.90.244.0/24
route del -net 112.91.133.0/24
route del -net 112.95.129.56/29
route del -net 112.95.138.128/25
route del -net 112.95.140.128/25
route del -net 112.95.240.0/22
route del -net 112.111.0.0/16
route del -net 112.124.182.91/32
route del -net 112.125.0.0/16
route del -net 112.128.0.0/14
route del -net 113.24.0.0/14
route del -net 113.31.0.0/17
route del -net 113.54.0.0/15
route del -net 113.64.0.0/10
route del -net 113.129.0.0/16
route del -net 113.136.0.0/20
route del -net 113.142.0.0/16
route del -net 113.248.0.0/14
route del -net 114.80.0.0/16
route del -net 114.111.160.0/20
route del -net 114.112.160.0/20
route del -net 114.113.196.0/22
route del -net 114.113.200.0/22
route del -net 114.117.0.0/16
route del -net 114.212.0.0/15
route del -net 114.214.0.0/16
route del -net 114.223.0.0/16
route del -net 114.224.0.0/16
route del -net 114.229.0.0/16
route del -net 114.237.0.0/16
route del -net 114.240.0.0/12
route del -net 115.24.0.0/14
route del -net 115.44.0.0/15
route del -net 115.48.0.0/12
route del -net 115.124.16.0/22
route del -net 115.154.0.0/15
route del -net 115.156.0.0/15
route del -net 115.158.0.0/16
route del -net 115.170.0.0/15
route del -net 115.181.0.0/16
route del -net 115.182.0.0/16
route del -net 115.236.96.0/23
route del -net 115.238.23.0/24
route del -net 116.4.0.0/14
route del -net 116.13.0.0/16
route del -net 116.16.0.0/12
route del -net 116.56.0.0/15
route del -net 116.58.208.0/20
route del -net 116.69.0.0/16
route del -net 116.70.0.0/20
route del -net 116.76.0.0/15
route del -net 116.193.56.178/32
route del -net 116.204.96.0/19
route del -net 116.205.96.0/19
route del -net 116.213.64.0/18
route del -net 116.213.128.0/17
route del -net 116.216.0.0/14
route del -net 116.226.0.0/16
route del -net 116.236.0.0/16
route del -net 116.242.0.0/15
route del -net 116.244.0.0/15
route del -net 116.252.183.0/24
route del -net 116.252.184.0/24
route del -net 116.254.128.0/17
route del -net 117.8.0.0/13
route del -net 117.22.231.0/24
route del -net 117.25.168.96/29
route del -net 117.29.58.0/24
route del -net 117.31.0.0/16
route del -net 117.53.48.141/32
route del -net 117.53.48.144/32
route del -net 117.60.0.0/16
route del -net 117.72.0.0/15
route del -net 117.75.0.0/16
route del -net 117.79.80.0/20
route del -net 117.79.128.0/19
route del -net 117.84.0.0/15
route del -net 117.89.104.0/23
route del -net 117.90.0.0/16
route del -net 117.92.0.0/16
route del -net 117.100.0.0/15
route del -net 117.103.16.141/32
route del -net 117.124.0.0/14
route del -net 117.128.0.0/10
route del -net 118.67.112.0/20
route del -net 118.84.204.0/24
route del -net 118.102.16.0/20
route del -net 118.123.202.0/24
route del -net 118.123.232.0/22
route del -net 118.123.236.0/25
route del -net 118.123.238.0/23
route del -net 118.123.250.0/23
route del -net 118.123.252.0/24
route del -net 118.124.0.0/19
route del -net 118.132.0.0/16
route del -net 118.144.0.0/14
route del -net 118.186.63.0/24
route del -net 118.194.0.0/19
route del -net 118.196.0.0/14
route del -net 118.202.0.0/15
route del -net 118.204.0.0/14
route del -net 118.224.0.0/13
route del -net 118.244.0.0/14
route del -net 119.10.0.0/24
route del -net 119.31.252.0/24
route del -net 119.31.254.0/24
route del -net 119.36.124.0/24
route del -net 119.38.216.0/21
route del -net 119.42.224.0/19
route del -net 119.75.208.0/20
route del -net 119.78.0.0/15
route del -net 119.97.130.0/24
route del -net 119.97.134.0/24
route del -net 119.120.0.0/13
route del -net 119.128.0.0/12
route del -net 119.144.0.0/14
route del -net 119.161.128.0/22
route del -net 119.161.144.0/20
route del -net 119.161.240.0/21
route del -net 119.167.235.0/24
route del -net 119.188.16.0/21
route del -net 119.253.0.0/16
route del -net 119.254.0.0/15
route del -net 120.32.0.0/13
route del -net 120.40.0.0/14
route del -net 120.94.0.0/15
route del -net 120.132.0.0/14
route del -net 120.196.210.0/23
route del -net 120.196.250.0/23
route del -net 120.196.253.0/24
route del -net 120.196.254.0/24
route del -net 120.204.200.0/23
route del -net 121.0.16.0/20
route del -net 121.4.0.0/15
route del -net 121.8.0.0/13
route del -net 121.16.0.0/12
route del -net 121.32.0.0/14
route del -net 121.36.0.0/19
route del -net 121.37.0.0/17
route del -net 121.48.0.0/15
route del -net 121.52.160.0/19
route del -net 121.52.208.0/20
route del -net 121.58.0.0/17
route del -net 121.68.0.0/14
route del -net 121.79.128.0/18
route del -net 121.101.208.0/20
route del -net 121.192.0.0/14
route del -net 121.199.14.91/32
route del -net 121.201.0.0/16
route del -net 121.204.0.0/14
route del -net 121.224.0.0/20
route del -net 121.224.224.0/19
route del -net 121.232.0.0/16
route del -net 121.234.0.0/16
route del -net 121.248.0.0/14
route del -net 122.10.128.0/19
route del -net 122.10.160.0/22
route del -net 122.11.32.0/19
route del -net 122.70.128.0/21
route del -net 122.70.138.0/24
route del -net 122.96.0.0/15
route del -net 122.136.0.0/13
route del -net 122.156.0.0/14
route del -net 122.192.0.0/14
route del -net 122.200.64.0/18
route del -net 122.204.0.0/14
route del -net 122.224.0.0/15
route del -net 122.226.240.0/24
route del -net 122.228.242.128/25
route del -net 122.229.0.0/16
route del -net 123.4.0.0/14
route del -net 123.8.0.0/13
route del -net 123.49.160.0/24
route del -net 123.58.160.0/19
route del -net 123.65.0.0/16
route del -net 123.88.0.0/15
route del -net 123.99.228.0/24
route del -net 123.100.0.0/19
route del -net 123.101.160.0/19
route del -net 123.101.192.0/18
route del -net 123.103.65.0/24
route del -net 123.103.66.32/27
route del -net 123.103.108.104/31
route del -net 123.112.0.0/12
route del -net 123.128.0.0/13
route del -net 123.138.0.0/15
route del -net 123.144.0.0/14
route del -net 123.148.0.0/16
route del -net 123.150.208.0/21
route del -net 123.150.216.0/22
route del -net 123.150.224.0/19
route del -net 123.151.36.0/23
route del -net 123.151.172.0/22
route del -net 123.151.176.0/20
route del -net 123.152.0.0/13
route del -net 123.172.0.0/14
route del -net 123.180.128.0/24
route del -net 123.196.0.0/15
route del -net 123.234.0.0/22
route del -net 124.14.0.0/15
route del -net 124.16.0.0/15
route del -net 124.28.192.0/18
route del -net 124.29.0.0/17
route del -net 124.42.0.0/17
route del -net 124.64.0.0/13
route del -net 124.72.0.0/14
route del -net 124.77.0.0/17
route del -net 124.88.0.0/14
route del -net 124.114.0.0/15
route del -net 124.117.0.0/16
route del -net 124.127.0.0/16
route del -net 124.128.0.0/13
route del -net 124.160.0.0/13
route del -net 124.172.0.0/14
route del -net 124.192.0.0/15
route del -net 124.200.0.0/13
route del -net 124.225.0.0/16
route del -net 124.227.230.0/24
route del -net 124.232.159.0/24
route del -net 124.234.0.0/15
route del -net 124.238.254.0/24
route del -net 124.250.0.0/15
route del -net 125.21.245.0/24
route del -net 125.32.0.0/12
route del -net 125.56.144.45/32
route del -net 125.64.6.0/24
route del -net 125.64.16.124/32
route del -net 125.64.16.126/32
route del -net 125.70.128.0/17
route del -net 125.73.0.0/16
route del -net 125.76.224.0/19
route del -net 125.77.0.0/16
route del -net 125.78.0.0/15
route del -net 125.80.0.0/13
route del -net 125.88.0.0/16
route del -net 125.90.64.0/22
route del -net 125.91.240.0/22
route del -net 125.91.244.0/23
route del -net 125.91.253.51/32
route del -net 125.96.0.0/15
route del -net 125.98.0.0/16
route del -net 125.171.0.0/16
route del -net 125.208.0.0/20
route del -net 125.211.0.0/16
route del -net 125.216.0.0/13
route del -net 125.252.220.45/32
route del -net 128.84.158.0/24
route del -net 128.220.160.140/32
route del -net 128.220.160.148/30
route del -net 128.220.205.153/32
route del -net 128.220.205.156/32
route del -net 128.232.233.0/26
route del -net 129.35.69.21/32
route del -net 129.35.76.0/24
route del -net 129.35.77.193/32
route del -net 129.41.4.137/32
route del -net 129.41.4.138/32
route del -net 129.41.4.140/32
route del -net 129.41.4.143/32
route del -net 129.41.4.144/30
route del -net 129.41.4.148/32
route del -net 129.41.4.154/32
route del -net 129.41.4.158/32
route del -net 129.41.4.171/32
route del -net 129.41.23.222/32
route del -net 129.42.24.230/32
route del -net 129.42.25.230/32
route del -net 129.42.32.230/32
route del -net 129.42.33.230/32
route del -net 129.42.40.230/32
route del -net 129.42.41.230/32
route del -net 130.88.203.58/32
route del -net 130.102.44.245/32
route del -net 130.102.44.247/32
route del -net 130.102.44.248/32
route del -net 132.151.9.22/32
route del -net 132.174.0.0/16
route del -net 132.243.5.113/32
route del -net 134.243.5.21/32
route del -net 134.243.5.42/32
route del -net 134.243.5.63/32
route del -net 134.243.5.70/32
route del -net 134.243.5.160/32
route del -net 134.243.85.3/32
route del -net 135.196.129.1/32
route del -net 135.196.210.140/32
route del -net 135.196.210.143/32
route del -net 135.196.210.155/32
route del -net 135.196.210.161/32
route del -net 135.196.210.170/32
route del -net 135.196.210.195/32
route del -net 135.196.210.201/32
route del -net 135.196.210.215/32
route del -net 135.196.210.229/32
route del -net 135.196.210.239/32
route del -net 135.196.210.242/32
route del -net 135.196.210.245/32
route del -net 135.196.210.248/32
route del -net 138.12.0.0/16
route del -net 140.98.193.0/24
route del -net 140.98.194.0/24
route del -net 140.234.0.0/16
route del -net 141.66.17.139/32
route del -net 141.66.17.140/32
route del -net 141.66.18.186/32
route del -net 141.66.176.200/32
route del -net 144.81.82.0/24
route del -net 144.81.87.0/24
route del -net 144.81.88.0/23
route del -net 144.212.244.9/32
route del -net 144.212.244.10/32
route del -net 145.36.40.90/32
route del -net 145.36.40.162/32
route del -net 145.36.42.0/24
route del -net 145.36.156.10/32
route del -net 149.28.1.0/24
route del -net 149.28.13.0/24
route del -net 149.28.15.0/24
route del -net 159.226.0.0/16
route del -net 160.109.98.0/24
route del -net 160.109.106.0/23
route del -net 160.109.108.0/23
route del -net 160.109.112.0/23
route del -net 160.109.114.0/24
route del -net 161.207.0.0/16
route del -net 162.105.0.0/16
route del -net 165.193.78.32/28
route del -net 165.193.81.224/28
route del -net 165.193.106.0/23
route del -net 165.193.159.0/24
route del -net 165.215.0.0/16
route del -net 166.111.0.0/16
route del -net 167.68.6.0/23
route del -net 167.68.47.14/32
route del -net 167.68.47.142/32
route del -net 167.139.0.0/16
route del -net 167.216.166.0/24
route del -net 168.160.0.0/16
route del -net 170.107.181.137/32
route del -net 170.107.181.167/32
route del -net 170.107.185.0/24
route del -net 170.107.188.0/22
route del -net 170.224.101.208/32
route del -net 171.66.120.0/21
route del -net 171.67.112.0/20
route del -net 174.46.196.128/25
route del -net 174.122.136.4/30
route del -net 174.122.136.8/31
route del -net 174.122.136.11/32
route del -net 174.143.45.135/32
route del -net 175.41.3.32/28
route del -net 175.41.3.48/32
route del -net 175.42.0.0/15
route del -net 175.44.0.0/16
route del -net 175.185.0.0/16
route del -net 175.186.0.0/15
route del -net 180.84.0.0/15
route del -net 180.96.0.0/23
route del -net 180.100.32.0/20
route del -net 180.118.0.0/16
route del -net 180.137.0.0/19
route del -net 180.152.0.0/13
route del -net 180.160.0.0/12
route del -net 180.201.0.0/16
route del -net 180.208.0.0/15
route del -net 182.92.0.0/16
route del -net 183.0.0.0/10
route del -net 183.168.0.0/13
route del -net 192.41.161.151/32
route del -net 192.58.150.0/24
route del -net 192.73.31.0/24
route del -net 192.73.216.0/24
route del -net 192.80.71.0/24
route del -net 192.84.75.0/24
route del -net 192.84.80.20/32
route del -net 192.84.80.37/32
route del -net 192.84.80.38/32
route del -net 192.87.127.79/32
route del -net 192.87.127.97/32
route del -net 192.87.127.98/32
route del -net 192.87.127.133/32
route del -net 192.87.127.134/32
route del -net 192.102.233.6/32
route del -net 192.132.2.0/24
route del -net 192.195.245.0/24
route del -net 192.231.246.0/24
route del -net 192.234.21.0/24
route del -net 192.234.22.0/24
route del -net 193.128.223.0/24
route del -net 193.130.39.176/28
route del -net 193.130.68.227/32
route del -net 193.130.69.16/32
route del -net 193.130.69.71/32
route del -net 193.131.119.0/24
route del -net 193.174.24.39/32
route del -net 193.174.240.6/32
route del -net 193.174.240.8/32
route del -net 193.194.158.0/24
route del -net 194.66.22.0/24
route del -net 194.119.138.1/32
route del -net 194.119.138.2/32
route del -net 194.119.138.6/32
route del -net 194.119.138.10/32
route del -net 194.128.228.153/32
route del -net 194.130.252.0/24
route del -net 194.209.48.0/24
route del -net 195.22.150.0/23
route del -net 195.27.60.0/24
route del -net 195.27.123.0/24
route del -net 195.27.130.0/24
route del -net 195.92.228.61/32
route del -net 195.92.228.71/32
route del -net 195.92.230.51/32
route del -net 195.144.0.13/32
route del -net 195.144.0.22/32
route del -net 195.144.0.26/32
route del -net 195.144.0.32/32
route del -net 195.144.0.50/31
route del -net 195.144.0.57/32
route del -net 195.144.0.58/32
route del -net 195.144.69.0/24
route del -net 195.178.165.0/24
route del -net 198.17.79.0/24
route del -net 198.45.22.173/32
route del -net 198.45.22.198/32
route del -net 198.80.148.147/32
route del -net 198.81.200.0/24
route del -net 198.108.24.0/24
route del -net 198.137.148.0/23
route del -net 198.137.150.0/24
route del -net 198.185.16.0/21
route del -net 198.185.24.0/23
route del -net 199.1.202.0/24
route del -net 199.4.154.0/23
route del -net 199.74.248.13/32
route del -net 199.98.88.0/24
route del -net 199.164.217.0/24
route del -net 202.4.128.0/19
route del -net 202.4.252.0/22
route del -net 202.14.235.3/32
route del -net 202.14.238.38/32
route del -net 202.38.2.0/23
route del -net 202.38.8.0/21
route del -net 202.38.64.0/18
route del -net 202.38.128.0/23
route del -net 202.38.132.0/22
route del -net 202.38.138.0/24
route del -net 202.38.140.0/23
route del -net 202.38.146.0/23
route del -net 202.38.152.0/23
route del -net 202.38.160.0/23
route del -net 202.38.164.0/22
route del -net 202.38.171.0/24
route del -net 202.38.176.0/23
route del -net 202.38.184.0/21
route del -net 202.38.192.0/18
route del -net 202.41.240.0/20
route del -net 202.43.144.0/20
route del -net 202.69.19.114/32
route del -net 202.91.176.0/20
route del -net 202.93.252.0/22
route del -net 202.95.0.0/19
route del -net 202.96.0.0/12
route del -net 202.112.0.0/13
route del -net 202.120.0.0/15
route del -net 202.122.32.0/21
route del -net 202.123.110.0/24
route del -net 202.127.0.0/18
route del -net 202.127.144.0/20
route del -net 202.127.160.0/21
route del -net 202.127.192.0/23
route del -net 202.127.200.0/21
route del -net 202.127.208.0/23
route del -net 202.127.216.0/21
route del -net 202.127.224.0/19
route del -net 202.130.0.0/19
route del -net 202.130.224.0/19
route del -net 202.131.208.0/20
route del -net 202.134.86.130/32
route del -net 202.152.176.0/20
route del -net 202.158.160.0/19
route del -net 202.160.176.0/20
route del -net 202.165.96.0/21
route del -net 202.165.104.0/22
route del -net 202.167.247.0/26
route del -net 202.179.240.0/20
route del -net 202.192.0.0/12
route del -net 203.81.16.0/20
route del -net 203.81.38.66/31
route del -net 203.81.38.68/32
route del -net 203.83.56.0/21
route del -net 203.86.0.0/19
route del -net 203.86.64.0/19
route del -net 203.88.32.0/19
route del -net 203.88.192.0/19
route del -net 203.91.46.40/32
route del -net 203.91.120.0/21
route del -net 203.93.0.0/16
route del -net 203.95.0.0/21
route del -net 203.98.210.56/29
route del -net 203.98.210.64/27
route del -net 203.100.92.0/22
route del -net 203.100.192.0/20
route del -net 203.110.167.240/32
route del -net 203.112.23.19/32
route del -net 203.119.24.0/21
route del -net 203.130.33.32/27
route del -net 203.134.240.0/22
route del -net 203.134.244.0/24
route del -net 203.156.243.195/32
route del -net 203.156.243.196/31
route del -net 203.175.128.0/19
route del -net 203.187.160.0/19
route del -net 203.192.0.0/19
route del -net 203.196.0.0/22
route del -net 203.196.4.0/24
route del -net 203.196.7.0/24
route del -net 203.207.64.0/18
route del -net 203.207.128.0/17
route del -net 203.208.0.0/20
route del -net 203.208.16.0/22
route del -net 203.208.32.0/19
route del -net 203.209.224.0/19
route del -net 203.212.0.0/20
route del -net 204.8.133.92/32
route del -net 204.8.133.211/32
route del -net 204.8.133.213/32
route del -net 204.8.133.217/32
route del -net 204.50.102.36/32
route del -net 204.50.102.245/32
route del -net 204.126.80.0/23
route del -net 204.153.51.0/24
route del -net 204.179.122.0/24
route del -net 204.228.64.0/24
route del -net 205.142.245.0/24
route del -net 205.203.134.1/32
route del -net 205.203.134.30/32
route del -net 205.217.165.64/26
route del -net 205.240.244.0/22
route del -net 205.243.231.0/24
route del -net 206.65.170.81/32
route del -net 206.188.17.13/32
route del -net 206.188.17.23/32
route del -net 206.188.17.33/32
route del -net 206.188.17.43/32
route del -net 206.188.17.53/32
route del -net 206.188.17.63/32
route del -net 206.188.17.73/32
route del -net 206.188.17.83/32
route del -net 206.188.17.93/32
route del -net 206.188.17.103/32
route del -net 206.188.17.115/32
route del -net 206.188.17.185/32
route del -net 206.188.17.195/32
route del -net 206.188.17.205/32
route del -net 207.24.35.0/24
route del -net 207.24.36.0/23
route del -net 207.24.38.0/24
route del -net 207.24.42.0/23
route del -net 207.24.44.0/23
route del -net 207.24.128.0/20
route del -net 207.25.176.0/21
route del -net 207.54.136.0/24
route del -net 207.97.243.216/32
route del -net 207.158.24.0/27
route del -net 207.164.255.103/32
route del -net 207.170.201.0/24
route del -net 207.170.231.0/24
route del -net 207.170.234.0/24
route del -net 207.170.239.0/24
route del -net 208.44.56.71/32
route del -net 208.44.56.210/31
route del -net 208.44.56.212/30
route del -net 208.44.56.216/30
route del -net 208.44.56.220/32
route del -net 208.76.204.0/22
route del -net 208.77.250.60/32
route del -net 208.85.175.16/32
route del -net 208.99.144.251/32
route del -net 208.176.18.0/24
route del -net 208.181.59.245/32
route del -net 208.181.59.253/32
route del -net 208.185.238.0/24
route del -net 208.197.26.35/32
route del -net 208.197.26.36/32
route del -net 208.215.179.0/24
route del -net 208.247.102.0/24
route del -net 208.254.38.80/32
route del -net 208.254.38.90/32
route del -net 208.254.74.84/32
route del -net 208.254.79.0/26
route del -net 209.116.81.5/32
route del -net 209.133.34.0/24
route del -net 209.195.157.0/24
route del -net 209.208.170.210/31
route del -net 209.225.25.11/32
route del -net 210.5.0.0/19
route del -net 210.14.112.0/23
route del -net 210.14.127.0/24
route del -net 210.12.0.0/14
route del -net 210.21.0.0/16
route del -net 210.22.0.0/16
route del -net 210.24.0.0/13
route del -net 210.32.0.0/12
route del -net 210.51.0.0/16
route del -net 210.52.0.0/15
route del -net 210.79.224.0/19
route del -net 210.72.0.0/13
route del -net 210.82.0.0/15
route del -net 210.87.128.0/18
route del -net 210.177.136.0/24
route del -net 210.185.192.0/18
route del -net 210.192.96.0/19
route del -net 210.210.18.35/32
route del -net 211.64.0.0/13
route del -net 211.80.0.0/12
route del -net 211.96.0.0/13
route del -net 211.136.0.0/13
route del -net 211.144.0.0/12
route del -net 211.160.0.0/13
route del -net 212.87.150.203/32
route del -net 212.87.150.207/32
route del -net 212.87.150.214/32
route del -net 212.87.150.216/32
route del -net 212.87.150.218/32
route del -net 212.111.43.128/25
route del -net 213.52.211.32/27
route del -net 213.130.39.122/32
route del -net 213.136.32.0/24
route del -net 213.170.149.226/31
route del -net 213.198.99.117/32
route del -net 213.212.74.227/32
route del -net 213.212.74.236/32
route del -net 213.219.33.0/24
route del -net 213.225.144.157/32
route del -net 213.225.144.190/32
route del -net 216.17.112.0/20
route del -net 216.27.103.128/25
route del -net 216.30.190.144/32
route del -net 216.30.190.146/32
route del -net 216.30.190.150/32
route del -net 216.30.190.153/32
route del -net 216.30.190.185/32
route del -net 216.30.190.224/32
route del -net 216.30.190.232/32
route del -net 216.30.190.234/32
route del -net 216.30.190.240/32
route del -net 216.33.115.0/24
route del -net 216.34.169.192/26
route del -net 216.35.79.115/32
route del -net 216.35.79.116/31
route del -net 216.35.79.118/32
route del -net 216.35.221.0/24
route del -net 216.52.17.96/32
route del -net 216.52.36.0/23
route del -net 216.52.184.240/32
route del -net 216.64.147.216/29
route del -net 216.73.87.52/32
route del -net 216.74.159.103/32
route del -net 216.74.159.106/32
route del -net 216.74.159.109/32
route del -net 216.74.159.112/32
route del -net 216.74.159.121/32
route del -net 216.83.187.0/24
route del -net 216.136.168.73/32
route del -net 216.143.112.0/24
route del -net 216.146.38.200/30
route del -net 216.146.38.204/32
route del -net 216.147.208.0/20
route del -net 216.162.203.72/29
route del -net 216.162.203.144/28
route del -net 216.176.50.163/32
route del -net 216.200.62.0/24
route del -net 216.200.249.0/24
route del -net 216.244.104.53/32
route del -net 217.7.141.143/32
route del -net 217.7.141.144/31
route del -net 217.7.141.149/32
route del -net 217.7.141.150/32
route del -net 217.68.67.34/32
route del -net 217.68.69.68/31
route del -net 217.68.69.70/32
route del -net 217.68.69.84/32
route del -net 217.154.120.7/32
route del -net 217.169.56.135/32
route del -net 217.169.56.154/32
route del -net 217.169.56.183/32
route del -net 217.169.56.230/32
route del -net 217.204.10.34/32
route del -net 218.0.0.0/11
route del -net 218.56.0.0/13
route del -net 218.64.0.0/11
route del -net 218.96.0.0/14
route del -net 218.104.0.0/14
route del -net 218.108.0.0/15
route del -net 218.192.0.0/12
route del -net 218.240.0.0/13
route del -net 218.249.0.0/16
route del -net 219.72.0.0/16
route del -net 219.82.0.0/16
route del -net 219.128.0.0/11
route del -net 219.216.0.0/13
route del -net 219.224.0.0/12
route del -net 219.242.0.0/15
route del -net 219.244.0.0/14
route del -net 220.112.0.0/14
route del -net 220.154.0.0/16
route del -net 220.160.0.0/11
route del -net 220.192.0.0/12
route del -net 220.231.0.0/18
route del -net 220.231.128.0/17
route del -net 220.232.64.0/18
route del -net 220.234.0.0/16
route del -net 220.242.0.0/15
route del -net 220.248.0.0/14
route del -net 220.252.0.0/16
route del -net 221.0.0.0/12
route del -net 221.122.0.0/15
route del -net 221.130.0.0/15
route del -net 221.137.0.0/16
route del -net 221.172.0.0/14
route del -net 221.176.0.0/13
route del -net 221.213.18.0/24
route del -net 221.192.0.0/11
route del -net 221.224.0.0/12
route del -net 222.122.11.0/24
route del -net 222.125.0.0/16
route del -net 222.0.0.0/8
route del -net 223.2.0.0/15
route del -net 223.128.0.0/15
route del -net 223.202.0.0/15
##### end batch route #####

#route del -host $PPTPSRV 
route del default gw $VPNGW
echo "$INFO add $OLDGW back as the default gw"
route add default gw $OLDGW
echo "$INFO $(date "+%d/%b/%Y:%H:%M:%S") vpndown.sh ended" >> $LOG

# release the lock                                                                                
rm -f $LOCK

